let ResponseUtils = require("../utils/ResponseUtils");
let TeacherService = require("../service/teacher");

/**
 * 城市控制器
 */
class TeacherController {
    static async index(ctx) {
        let result = await TeacherService.list(ctx.query.page);
        ctx.body = ResponseUtils.builder(result).success().build();
    }

    static async list(ctx) {
        let result = await TeacherService.list(ctx.params.storeId,ctx.query.page);
        ctx.body = ResponseUtils.builder(result).success().build();
    }

    static async list1(ctx) {
        let result = await TeacherService.list1(ctx.params.storeId);
        ctx.body = ResponseUtils.builder(result).success().build();
    }

    static async detail(ctx) {
        let result = await TeacherService.detail(ctx.params.id);
        ctx.body = ResponseUtils.builder(result).success().build();
    }


    static async create(ctx) {
        let result = await TeacherService.create(ctx.request.body);
        ctx.body = ResponseUtils.builder(result).success().build();
    }
    static async update(ctx) {
        let result = await TeacherService.update(ctx.request.body);
        ctx.body = ResponseUtils.builder(result).success().build();
    }

    static async delete(ctx) {
        let id = ctx.params.id;
        let result = await TeacherService.delete(id);
        ctx.body = ResponseUtils.builder(result).success().build();
    }
}

module.exports = TeacherController;
